import Taro from '@tarojs/taro';
import { View,Text, Form, Button } from '@tarojs/components';
import http from '@/utils/http';
import { get as getGlobalData } from '@/global'
import './index.scss'

let app = Taro.getApp();
export default class AutoFocus extends Taro.Component {
    static defaultProps = {
        data: {},
        renderCat:''
    }
    bindsubmit(e) {
        console.log(e);
        var formId = e.detail.formId;
        if (formId == "the formId is a mock one") {//非真机
            return;
        }
        var openId = app.getValueSync('openId');
        if (openId) {
            // http.get('setFormId', {
            //     formId,
            //     openId
            // }, null, null,false).then((d) => {
            //     console.log('打印formId' + formId)
            //     console.log(d)
            // })
        }
    }
    render() {
        let { data } = this.props;
        return (
            <View className='box'>
                <Form
                  data-data={data}
                  reportSubmit
                  className='form'
                  onSubmit={(e) => { this.bindsubmit(e)}}
                >
                    <Button form-type='submit'>
                        {this.props.renderCat}
                    </Button>
                </Form>
            </View>
        )
    }
}
